/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pengendali;

import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import model.Yudisium;

/**
 *
 * @author admin
 */
public class PengendaliPendaftaranYudisium {

    public static void pendaftaranYudisiumMahasiswa(javax.swing.JTextField tNim,
            javax.swing.JTextField tNama, javax.swing.JComboBox cbProdi, javax.swing.JTextField tNoHP,
            javax.swing.JTextField tPeriode, javax.swing.JCheckBox bNilai, javax.swing.JCheckBox bTa,
            javax.swing.JCheckBox bBebasLeb, javax.swing.JCheckBox bBebasSDoden, javax.swing.JCheckBox bKP,
            javax.swing.JCheckBox bKKL) {
        try {
            java.sql.Date date = java.sql.Date.valueOf(tPeriode.getText());
            Yudisium yud = new Yudisium();
            yud.setNim(tNim.getText());
            yud.setNama(tNama.getText());
            yud.setProdi(cbProdi.getSelectedItem().toString());
            yud.setNomor_hp(tNoHP.getText());
            yud.setPeriode_yudisium(date);
            yud.setDaftar_nilai(bNilai.isSelected());
            yud.setNaskah_ta(bTa.isSelected());
            yud.setBebas_pinjam_lab(bBebasLeb.isSelected());
            yud.setBebas_pinjam_dos(bBebasSDoden.isSelected());
            yud.setPenyerahan_KP(bKP.isSelected());
            yud.setKeterangan_kkl(bKKL.isSelected());
            Yudisium.setPendaftaranYudisium(yud);
            JOptionPane.showMessageDialog(null, "Konfirmasi data telah tersimpan.");
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, ex);
            Logger.getLogger(PengendaliPendaftaranYudisium.class.getName()).log(Level.SEVERE, null, ex);
        } catch (java.lang.IllegalArgumentException ex) {
            JOptionPane.showMessageDialog(null, ex + "Format tanggal salah.");
            Logger.getLogger(PengendaliPendaftaranYudisium.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
